/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-04
 * Time: 19:24
 */
class MyBlockingQueue {
    private int[] elems=null;
    public int head;
    public int tail;
    int size;
    public MyBlockingQueue(int capaticy){
        this.elems=new int[capaticy];
    }
    public void putElems(int val){
        if(size==elems.length){
            //阻塞
            return;
        }
        elems[tail]=val;
        tail++;
        size++;
        if(tail>=elems.length){
            tail=0;
        }

    }
    public int takeElems(){
        if(size==0){
            //阻塞
            return -1;
        }
        int t=elems[head];
        head++;
        size--;
        if(head>elems.length){
            head=0;
        }

    }
}
public class Demo1 {
    public static void main(String[] args) {

    }
}
